str = "select 刷卡时间 from 职工考勤信息表 where 职工编号 = '" _

来源:百度知道 编辑:UC知道 时间:2024/05/16 07:20:23
高手来帮改下,急用啊,谢了!
这是计算加班时长的问题
str = "select 刷卡时间 from 职工考勤信息表 where 职工编号 = '" _
+ Me.txtnum.Text + "'"
total = CStr(CInt(txttime.Text) - CInt(str))
strnum = "update 职工考勤信息表 set 加班时长='" & total & "' where 职工编号='" & Text1.Text & "'"""
db.RunSelectSQL (str)
MsgBox ("保存成功")

运行之后说类型不匹配,数据库中str那个刷卡时间设置的是char
total = CStr(CInt(txttime.Text) - CInt(str))是这句类型不匹配!
不好用--|||
VB VB VB
不好用不好用--||| 不好用不好用--!!

晕 where条件都不全
select 刷卡时间 from 职工考勤信息表 where 职工编号="&id&"
职工编号那错了
自动编号的话 "+Me.txtnum.Text +" 而不是'"+Me.txtnum.Text +"'

str = "select 刷卡时间 as shuaka from 职工考勤信息表 where 职工编号 = '"&Me.txtnum.Text &"'"
搞不清你用的那种语言,如果是VB的话用上面的.
----------------------------------------------------------
total = CStr(CInt(txttime.Text) - CInt(rs("shuaka")))
rs是记录集对象